import com.mapper.UserMapperImpl;
import com.pojo.User;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Mytest {
    @Test
    public void test(){
        ClassPathXmlApplicationContext cpx = new ClassPathXmlApplicationContext("Spring-dao.xml");
        UserMapperImpl mapper = cpx.getBean("userMapper", UserMapperImpl.class);
        for (User user : mapper.selectUser()) {
            System.out.println(user);  //可以看到,在将Spring和Mybatis整合了之后,需要我们写的代码更加简便,更加少
        }
    }
}
